/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proy;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author ROBERT
 */
@Entity
@Table(name = "bloque", catalog = "inmaes", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Bloque.findAll", query = "SELECT b FROM Bloque b"),
    @NamedQuery(name = "Bloque.findById", query = "SELECT b FROM Bloque b WHERE b.id = :id"),
    @NamedQuery(name = "Bloque.findByDensidad", query = "SELECT b FROM Bloque b WHERE b.densidad = :densidad"),
    @NamedQuery(name = "Bloque.findByLargo", query = "SELECT b FROM Bloque b WHERE b.largo = :largo"),
    @NamedQuery(name = "Bloque.findByAncho", query = "SELECT b FROM Bloque b WHERE b.ancho = :ancho"),
    @NamedQuery(name = "Bloque.findByAlto", query = "SELECT b FROM Bloque b WHERE b.alto = :alto"),
    @NamedQuery(name = "Bloque.findByRendimiento", query = "SELECT b FROM Bloque b WHERE b.rendimiento = :rendimiento"),
    @NamedQuery(name = "Bloque.findByTipo", query = "SELECT b FROM Bloque b WHERE b.tipo = :tipo"),
    @NamedQuery(name = "Bloque.findByDescripcion", query = "SELECT b FROM Bloque b WHERE b.descripcion = :descripcion"),
    @NamedQuery(name = "Bloque.findByCliente", query = "SELECT b FROM Bloque b WHERE b.cliente = :cliente"),
    @NamedQuery(name = "Bloque.findByIdFormula", query = "SELECT b FROM Bloque b WHERE b.idFormula = :idFormula")})
public class Bloque implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "densidad")
    private Integer densidad;
    @Column(name = "largo")
    private Integer largo;
    @Column(name = "ancho")
    private Integer ancho;
    @Column(name = "alto")
    private Integer alto;
    @Column(name = "rendimiento")
    private Integer rendimiento;
    @Column(name = "tipo")
    private Integer tipo;
    @Column(name = "descripcion")
    private String descripcion;
    @Column(name = "cliente")
    private Integer cliente;
    @Column(name = "id_formula")
    private Integer idFormula;

    public Bloque() {
    }

    public Bloque(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public Integer getDensidad() {
        return densidad;
    }

    public void setDensidad(Integer densidad) {
        Integer oldDensidad = this.densidad;
        this.densidad = densidad;
        changeSupport.firePropertyChange("densidad", oldDensidad, densidad);
    }

    public Integer getLargo() {
        return largo;
    }

    public void setLargo(Integer largo) {
        Integer oldLargo = this.largo;
        this.largo = largo;
        changeSupport.firePropertyChange("largo", oldLargo, largo);
    }

    public Integer getAncho() {
        return ancho;
    }

    public void setAncho(Integer ancho) {
        Integer oldAncho = this.ancho;
        this.ancho = ancho;
        changeSupport.firePropertyChange("ancho", oldAncho, ancho);
    }

    public Integer getAlto() {
        return alto;
    }

    public void setAlto(Integer alto) {
        Integer oldAlto = this.alto;
        this.alto = alto;
        changeSupport.firePropertyChange("alto", oldAlto, alto);
    }

    public Integer getRendimiento() {
        return rendimiento;
    }

    public void setRendimiento(Integer rendimiento) {
        Integer oldRendimiento = this.rendimiento;
        this.rendimiento = rendimiento;
        changeSupport.firePropertyChange("rendimiento", oldRendimiento, rendimiento);
    }

    public Integer getTipo() {
        return tipo;
    }

    public void setTipo(Integer tipo) {
        Integer oldTipo = this.tipo;
        this.tipo = tipo;
        changeSupport.firePropertyChange("tipo", oldTipo, tipo);
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        String oldDescripcion = this.descripcion;
        this.descripcion = descripcion;
        changeSupport.firePropertyChange("descripcion", oldDescripcion, descripcion);
    }

    public Integer getCliente() {
        return cliente;
    }

    public void setCliente(Integer cliente) {
        Integer oldCliente = this.cliente;
        this.cliente = cliente;
        changeSupport.firePropertyChange("cliente", oldCliente, cliente);
    }

    public Integer getIdFormula() {
        return idFormula;
    }

    public void setIdFormula(Integer idFormula) {
        Integer oldIdFormula = this.idFormula;
        this.idFormula = idFormula;
        changeSupport.firePropertyChange("idFormula", oldIdFormula, idFormula);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bloque)) {
            return false;
        }
        Bloque other = (Bloque) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "proy.Bloque[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
